import os
import sys
import static_variables
from GitCommitClient import GitCommitClient
def exit_print(exit_signal):
    if exit_signal == 1:
        print("config file not found.")
    elif exit_signal == 2:
        print("REPO_NAME not found.")
    elif exit_signal == 3:
        print("Projects not found.")
    input("press any key to continue...\n")


if __name__ == "__main__":
    i_exit = 0
    # 判断配置文件是/否存在
    if not os.path.exists(static_variables.CONF):
        i_exit = 1
    else:
        # 初始化类
        git_data = GitCommitClient(static_variables.CONF)
        # 生成qms需要的csv数据文件
        i_exit = git_data.each_projects()
        # 删除临时文件
        git_data.del_temp_file()
    # 打印信息，并在屏幕等待
    exit_print(i_exit)
    sys.exit(i_exit)
